// ****************************************************************************
// *     Filename:  EventAction.hh
// *  Description:  
// *      License:  Geant4 Software License 
// *                http://geant4.cern.ch/license/LICENSE.html
// *       Author:  Tran Hoai Nam (nam), nam@kuno-g.phys.sci.osaka-u.ac.jp
// * Organization:  Osaka University
// *      Created:  2012-09-14 15:29:01
// ****************************************************************************
#ifndef EVENTACTION_TBFR14DG
#define EVENTACTION_TBFR14DG

#include "G4UserEventAction.hh"
#include "globals.hh"
#include <stdint.h>
#include "../rootlibs/TEvent.h"

class PrimaryGeneratorAction;
class G4SDManager;
class HistoManager;
class MyHit;
class Dict;

class EventAction : public G4UserEventAction {
	public:
		EventAction();
		EventAction(PrimaryGeneratorAction*);
		EventAction(HistoManager* histo, PrimaryGeneratorAction *priGenAction);
		~EventAction();

		void BeginOfEventAction(const G4Event*);
		void EndOfEventAction(const G4Event* event);
		G4double ReadEdep(const G4Event* event, G4String detName);
		void ReadoutDetector(const G4Event *event,G4String detName);
		void ProcessHit(MyHit *);

		void ReadEdep(const G4Event *event,G4String detName,uint8_t id);
		void ReadoutTarget(const G4Event *event,G4String detName,uint8_t);
		void ProcessTargetHit(MyHit *,uint8_t);
		void ReadoutTracker(const G4Event *event,G4String detName,uint8_t);
		void ProcessTrackerHit(MyHit *,uint8_t);

		void AddTrack(unsigned int id, G4String vol, unsigned int copy);

	private:
		PrimaryGeneratorAction *fpPriGen;
		G4SDManager* fpSDMan;
		HistoManager *fpHistoMan;
		TEvent *fpEvt;
		Dict *fpDict;
};

#endif /* end of include guard: EVENTACTION_TBFR14DG */
